<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<style>
    .lleff{width: calc(50% - 2px);float: left;border:1px solid #eee;height: 600px}
    .banlan{width: 100%;;margin: 0 auto;}
    .banlan .lankuai{width: 100%;height: 100%;text-align: center}
    .banlan .lankuai{height: 100%;}
    .banlanbut{position: absolute;right: 80px;top: 35px;background-color: #f4f4f4;color: #575757;border: 1px solid #aaa}
    .banlanbut:hover{background-color: #0079fe;color: #FFFFFF;border: 1px solid #0079fe}
</style>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
<!--                <button class="layui-btn layui-btn-sm btn-dark marginr5 layui-hide" id="bao_yulan" type="button" style="background-color: #FFFFFF!important;color: #777!important;border-color: #ccc">预览</button>-->
                <button class="layui-btn layui-btn-sm btn-dark marginr5 layui-hide" id="ban_down" type="button" style="background-color: #FFFFFF!important;color: #777!important;border-color: #ccc">下载模板</button>
                <button class="layui-btn layui-btn-sm btn-dark marginr5 layui-hide" id="bao_down" type="button" style="background-color: #FFFFFF!important;color: #777!important;border-color: #ccc">下载文件</button>
                <div id="shenbox" class="layui-hide">
                    <button class="layui-btn layui-btn-sm btn-dark marginr5" type="button" onclick="check_status(1)" style="background-color: #4CAF50!important;">
                        <i class="layui-icon layui-icon-ok"></i>通过
                    </button>
                    <button class="layui-btn layui-btn-sm btn-light marginr5" type="button" onclick="check_status(9)" style="background-color: #ff982e!important">
                        <i class="layui-icon layui-icon-close"></i>驳回
                    </button>
                </div>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">


        <div class="table-box tablenes">
            <div class="title">
                <div style="float: left;width: 50%">模板信息</div>
                <div style="float: left;width: 50%">文件信息</div>
            </div>
            <div>
                <div class="lleff fileban">
                    <div class="banlan">
                        <div class="lankuai lan_img"><img id="nanimgs_ban" src="" style="width: 100%;height: 100%;max-height: 600px"></div>
                        <div class="lankuai layui-hide lan_pdf"><iframe src="" frameborder="0" width="100%" height="600"></iframe></div>
                        <div class="lankuai layui-hide lan_doc"><iframe src="" frameborder="0" width="100%" height="600"></iframe></div>
                        <div class="lankuai layui-hide lan_video">
                            <video controls autoplay style="width: 100%;height: 100%">
                                <source src="" type="video/mp4">
                            </video>
                        </div>
                        <div class="lankuai lan_nolan"><img src="/static/admin/images/noban.png"></div>
                    </div>
                </div>
                <div class="lleff filebao">
                    <div class="banlan">
                        <div class="lankuai lan_img"><img id="nanimgs_bao" src="" style="width: 100%;height: 100%;max-height: 600px"></div>
                        <div class="lankuai layui-hide lan_pdf"><iframe src="" frameborder="0" width="100%" height="600"></iframe></div>
                        <div class="lankuai layui-hide lan_doc"><iframe src="" frameborder="0" width="100%" height="600"></iframe></div>
                        <div class="lankuai layui-hide lan_video">
                            <video controls autoplay style="width: 100%;height: 100%">
                                <source src="" type="video/mp4">
                            </video>
                        </div>
                        <div class="lankuai lan_nolan"><img src="/static/admin/images/nolan.png"></div>
                    </div>
                </div>
            </div>
        </div>

        <div class="table-box tablenes">
            <div class="title">基本信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">审核状态</td><td class="tv" id="status_name"></td><td class="tt">所属项目</td><td class="tv" id="enginid_name"></td></tr>
                <tr><td class="tt">文件名称</td><td class="tv" id="name"></td><td class="tt">文件位置</td><td class="tv" id="muid_name"></td></tr>
                <tr><td class="tt">文件类型</td><td class="tv" id="ext"></td><td class="tt">文件大小</td><td class="tv" id="size"></td></tr>
                <tr><td class="tt">上传人</td><td class="tv" id="created_user_name"></td><td class="tt">上传单位</td><td class="tv" id="dealid_name"></td></tr>
                <tr><td class="tt">备注</td><td class="tv" id="explain" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>

        <div><?php include '../public/opt_browse.php'?></div>
    </div>
</div>
<script>
    var param_id = getQueryVariable('id') || 0;
    var param_shen = getQueryVariable('shen') || '';



    function setYulanFileBao(data, dom, nanimgsDom, types) {
        $("."+dom+" .lankuai").addClass('layui-hide');
        var ext = data.ext;
        var encpath = data.encpath;

        if(types == 'bao'){
            var setUrls = get_bao_file_complete(encpath);
        }else{
            var setUrls = get_ban_file_complete(encpath);
        }





        $("."+dom+" .lan_img").find('img').attr('src', '');
        $("."+dom+" .lan_pdf").find('iframe').attr('src', '');
        $("."+dom+" .lan_doc").find('iframe').attr('src', '');
        $("."+dom+" .lan_video").find('video').attr('src', '');

        if(ext == 'png' || ext == 'pneg' || ext == 'jpg' || ext == 'jpeg' || ext == 'gif'){
            $("."+dom+" .lan_img").removeClass('layui-hide');
            var imgElement = document.getElementById(nanimgsDom);
            imgElement.src = setUrls;
            imgElement.src = imgElement.src + '?timestamp=' + new Date().getTime();


            upload_files_file_viewer(nanimgsDom);
        }else if(ext == 'pdf'){
            $("."+dom+" .lan_pdf").removeClass('layui-hide');
            $("."+dom+" .lan_pdf").find('iframe').attr('src', setUrls);
        }else if(ext == 'doc' || ext == 'docx' || ext == 'xls' || ext == 'xlsx' || ext == 'ppt' || ext == 'pptx'){
            layui.use(['laytp'], function() {
                $.ajax({
                    url:setUrls,
                    type:'get',
                    data:{token:facade.getCookie('token')},
                    dataType:'json',
                    async: false,
                    success:function (e) {
                        if(e.code == 2000){
                            var urls = "https://view.officeapps.live.com/op/view.aspx?src="+encodeURI(server_doc_name+e.data);
                            $("."+dom+" .lan_doc").removeClass('layui-hide');
                            $("."+dom+" .lan_doc").find('iframe').attr('src', urls);
                        }
                    }
                });
            });
        }else if(ext == 'mp4'){
            layui.use(['laytp'], function() {
                $.ajax({
                    url:setUrls,
                    type:'get',
                    data:{token:facade.getCookie('token')},
                    dataType:'json',
                    async: false,
                    success:function (e) {
                        if(e.code == 2000){
                            $("."+dom+" .lan_video").removeClass('layui-hide');
                            $("."+dom+" .lan_video").find('video').attr('src', server_doc_name+e.data);
                        }
                    }
                });
            });
        }else{
            $("."+dom+" .lan_nolan").removeClass('layui-hide');
        }
    }


    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_engin_bao_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;

                $("#status_name").html(data.status_name);
                $("#muid_name").text(data.muid_name);
                $("#enginid_name").text(data.enginid_name);
                $("#name").text(data.name);
                $("#ext").text(data.ext);
                $("#size").text(data.size+' KB');
                $("#created_user_name").text(data.created_user_name);
                $("#dealid_name").text(data.dealid_name);
                $("#explain").text(data.explain);

                if(param_shen && res.data.isshen){
                    $("#shenbox").removeClass('layui-hide');
                }


                $("#bao_yulan").removeClass('layui-hide').click(function () {
                    get_yulan_bao_file(data.ext, data.encpath)
                });
                $("#bao_down").removeClass('layui-hide').click(function () {
                    public_down_bao_file(data.encpath)
                });


                setYulanFileBao(data, 'filebao', 'nanimgs_bao', 'bao');

                if(res.data.muinfo.ismu > 0){
                    $("#ban_down").removeClass('layui-hide').click(function () {
                        public_down_ban_file(res.data.muinfo.encpath)
                    });
                    setYulanFileBao(res.data.muinfo, 'fileban', 'nanimgs_ban', 'ban');
                }


                // $(".pageshowtitle").text('文件上报信息');
                render_from();
            }
        });

        public_get_readsandlog('engin_bao', param_id);
        showpage_dropopt();
    });



    function check_status(status) {
        openPage('shen.php?id='+param_id+'&status='+status, '770px', '490px');
    }



    if(typeof(viewerObj) === "undefined" || typeof(viewerObj) === undefined || viewerObj == null){
        var viewerObj = [];
    }

</script>
</body>
</html>




